package com.example.demo.service;

import com.example.demo.dao.ArticleMapper;
import com.example.demo.model.ArticleInfo;
import com.example.demo.model.UserInfo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class ArticleService {
    @Resource
    private ArticleMapper articleMapper;

    public List<ArticleInfo> getArticlesByUid(int uid) {
        return articleMapper.getArticlesByUid(uid);
    }

    public int delete(int aid, int uid) {
        return articleMapper.delete(aid, uid);
    }

    public int insert(ArticleInfo articleInfo) {
        return articleMapper.insert(articleInfo);
    }

    public ArticleInfo getArticleByAidAndUid(int aid, int uid) {
        return articleMapper.getArticleByAidAndUid(aid, uid);
    }

    public int update(ArticleInfo articleInfo) {
        return articleMapper.update(articleInfo);
    }

    public ArticleInfo detail(int aid) {
        return articleMapper.detail(aid);
    }

    public int getArticlesCount(int uid) {
        return articleMapper.getArticlesCount(uid);
    }

    public int increaseReadCount(int aid) {
        return articleMapper.increaseReadCount(aid);
    }

    public List<ArticleInfo> getArticlesByPage(int size, int offset) {
        return articleMapper.getArticlesByPage(size, offset);
    }

    public int AllArticlesCount() {
        return articleMapper.AllArticlesCount();
    }
}
